package org.duoyi.striver.model.impl;

import cn.hutool.core.util.RandomUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

@Slf4j
public class Sleeper {

    public static void sleep(long ms) {
        try {
//            log.debug("延时{}ms", ms);
            TimeUnit.MILLISECONDS.sleep(ms);
        } catch (InterruptedException e) {
            log.error("睡眠失败");
        }
    }

    public static void sleep() {
        sleep(RandomUtil.randomLong(500, 1000));
    }

}
